unit Unit12;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, DB, ZAbstractRODataset, ZAbstractDataset,
  ZDataset, Menus;

type
  TForm12 = class(TForm)
    ZQuery1: TZQuery;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    PopupMenu1: TPopupMenu;
    procedure DBGrid1DblClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;


var
  Form12: TForm12;

implementation

uses
  Unit5, users;

{$R *.dfm}

procedure TForm12.DBGrid1DblClick(Sender: TObject);
begin
  Application.CreateForm(TForm6, Form6);
  DataModule5.ZTable1.TableName := 'users';
  DataModule5.ZTable1.Active := true;
  Form6.DBGrid1.Columns[0].FieldName := 'login';
  Form6.DBGrid1.Columns[1].FieldName := 'role';
  Form6.DBGrid1.Columns[2].FieldName := 'group';
  DataModule5.ZTable1.Filter := '`' + DataModule5.ZTable1.Fields[5].FieldName + '` = "' + Form12.DataSource1.DataSet.FieldValues['gname'] + '"';
  //Form6.DBGrid1.DataSource.DataSet.Filter := Form6.DBGrid1.DataSource.DataSet.Fields[5].FieldName + ' LIKE ' + '"' + Form12.DataSource1.DataSet.FieldValues['gname'] + '"';
  //DataModule5.ZTable1.Filter := DataModule5.ZTable1.Fields[5].FieldName + ' LIKE ' + '"' + Form12.DataSource1.DataSet.FieldValues['gname'] + '"';
  showmessage(Form6.DBGrid1.DataSource.DataSet.Fields[5].FieldName + '=' + '"' + Form12.DataSource1.DataSet.FieldValues['gname'] + '"');
  DataModule5.ZTable1.Filtered := true;
  //DataModule5.ZTable1.Filtered := true;
  //Form6.DBGrid1.DataSource.DataSet.Filtered := true;
end;

end.
